package enemies;
/*
 * A class of enemies which has 5 HP, and fire normal missiles
 */

import java.util.*;
import javax.swing.Timer;

import Missiles.EnemyBasicMissile;
import Missiles.Missile;

import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;

public class StrongEnemy extends BasicEnemy implements ActionListener
{
	protected Timer timer;
	protected ArrayList<Missile> enemyMissiles;
	
	public StrongEnemy(int x, ArrayList<Missile> m) 
	{	this(x, 0, m);	}
	
	public StrongEnemy(int x, int y, ArrayList<Missile> m)
	{
		super(x,y);
		damageHitPlayer = 3;
		maxHP = 6;
		hp = maxHP;
		dropRate = 0.4; //higher dropRate
		enemyMissiles = m;
        setImage(STRONG_ENEMY);
		
		timer = new Timer(1500, this);
	    timer.start();
	}
	
	public void stop() //it's dead
	{	timer.stop();	}
	
	public void actionPerformed(ActionEvent e)  //it fires missiles
	{	
		double angle = Math.random() * Math.PI/3 - Math.PI/6;
		enemyMissiles.add(new EnemyBasicMissile(getX() + width/2, getY() + height, angle, false));
	}
}
